/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package netshop;

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author Administrator
 */
public class province extends HttpServlet {
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
    /**
     * Handles the HTTP <code>GET</code> method.
     *
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
       doPost(request,response);
    }

    /**
     * Handles the HTTP <code>POST</code> method.
     *
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
       String data = " {\"count\":31,\"list\":[{\"pcaID\":\"01\",\"pcaname\":\"安徽省\"},{\"pcaID\":\"02\",\"pcaname\":\"北京\"},{\"pcaID\":\"03\",\"pcaname\":\"福建省\"},{\"pcaID\":\"04\",\"pcaname\":\"甘肃省\"},{\"pcaID\":\"05\",\"pcaname\":\"广东省\"},{\"pcaID\":\"06\",\"pcaname\":\"广西省\"},{\"pcaID\":\"07\",\"pcaname\":\"贵州省\"},{\"pcaID\":\"08\",\"pcaname\":\"海南省\"},{\"pcaID\":\"09\",\"pcaname\":\"河北省\"},{\"pcaID\":\"10\",\"pcaname\":\"河南省\"},{\"pcaID\":\"11\",\"pcaname\":\"黑龙江省\"},{\"pcaID\":\"12\",\"pcaname\":\"湖北省\"},{\"pcaID\":\"13\",\"pcaname\":\"湖南省\"},{\"pcaID\":\"14\",\"pcaname\":\"吉林省\"},{\"pcaID\":\"15\",\"pcaname\":\"江苏省\"},{\"pcaID\":\"16\",\"pcaname\":\"江西省\"},{\"pcaID\":\"17\",\"pcaname\":\"辽宁省\"},{\"pcaID\":\"18\",\"pcaname\":\"内蒙古\"},{\"pcaID\":\"19\",\"pcaname\":\"宁夏\"},{\"pcaID\":\"20\",\"pcaname\":\"青海省\"},{\"pcaID\":\"21\",\"pcaname\":\"山东省\"},{\"pcaID\":\"22\",\"pcaname\":\"山西省\"},{\"pcaID\":\"23\",\"pcaname\":\"陕西省\"},{\"pcaID\":\"24\",\"pcaname\":\"上海\"},{\"pcaID\":\"25\",\"pcaname\":\"四川省\"},{\"pcaID\":\"26\",\"pcaname\":\"天津\"},{\"pcaID\":\"27\",\"pcaname\":\"西藏\"},{\"pcaID\":\"28\",\"pcaname\":\"新 疆\"},{\"pcaID\":\"29\",\"pcaname\":\"云南省\"},{\"pcaID\":\"30\",\"pcaname\":\"浙江省\"},{\"pcaID\":\"31\",\"pcaname\":\"重庆\"}]}";

		response.setContentType("text/html;charset=gb2312");
response.setHeader("Access-Control-Allow-Origin", "*");
            try (PrintWriter out = response.getWriter()) {
                out.println(data);
                out.flush();
            }
    }

    /**
     * Returns a short description of the servlet.
     *
     * @return a String containing servlet description
     */
    @Override
    public String getServletInfo() {
        return "Short description";
    }// </editor-fold>

}
